{% extends 'master.jinja2' %}
{% block main %}
<div class="container">
    <div class="row">
        <!--left-->
        <div class="col-md-4 col-sm-4 col-lg-4" id="catergory_body">
            {{ panel('category',category_id) }}

            <div class="panel panel-success">
                <div class="panel-heading">当月热销榜</div>
                <div class="panel-body">
                    {{ panel('item_bill',category_id) }}
                </div>
            </div>
        </div>
        <!--left-->
        <!--right-->
        <div class="col-md-8 col-sm-8 col-lg-8">
            <table class="table table-striped home_table_list">
                <tbody>
                    <tr>
                    <td> <b>价格区间：</b></td>
                    <td>
                        <a class="btn btn-primary btn-xs" href="{{request.route_url('category',id=category_id)}}?p={{page_num}}">
                            全部
                        </a>
                        <a class="btn btn-link btn-xs" href="{{request.route_url('category',id=category_id)}}?p={{page_num}}&start_price=0&&end_price=99">
                            0~99
                        </a>
                        <a class="btn btn-link btn-xs" href="{{request.route_url('category',id=category_id)}}?p={{page_num}}&start_price=100&&end_price=499">
                            100~499
                        </a>
                        <a class="btn btn-link btn-xs" href="{{request.route_url('category',id=category_id)}}?p={{page_num}}&start_price=500&&end_price=999">
                            500~999
                        </a>
                        <a class="btn btn-link btn-xs" href="{{request.route_url('category',id=category_id)}}?p={{page_num}}&start_price=1000&&end_price=4999">
                            1000~4999
                        </a>
                        <a class="btn btn-link btn-xs" href="{{request.route_url('category',id=category_id)}}?p={{page_num}}&start_price=5000&&end_price=9999">
                            5000~9999
                        </a>
                        <a class="btn btn-link btn-xs" href="{{request.route_url('category',id=category_id)}}?p={{page_num}}&start_price=10000">
                            10000~
                        </a>
                    </td>
                </tr>
            </tbody>
            </table>
            <div class="panel panel-primary">
                <div class="panel-heading">商品列表</div>
                 {% if items %}
                <div class="panel-body">
                    {% for item_one in items %}
                        <div class="col-sm-4 col-md-4">
                            <div class="thumbnail" style="border: 0">
                                <img src="{{request.static_url('myproject:static/uploads/20160801/20160801175305728.jpg')}}" alt="{{item_one.name}}" class="thumbnail">
                                <div class="caption">
                                    <ul class="nav nav-pills nav-stacked">
                                         <li>
                                             <p class="text-center">
                                                 <a href="{{request.route_url('item',id=item_one.id)}}">{{item_one.name}}</a>
                                             </p>
                                        </li>
                                        <li>
                                             <p class="text-center">
                                                <strong class="text-danger">￥{{item_one.price}}</strong>
                                             </p>
                                        </li>

                                        <li>
                                            <p class="text-center">
                                                <span class="text-danger">销售({{item_one.num}})</span>
                                            </p>
                                        </li>
                                        <li>
                                            <p class="text-center">
                                                <a href="{{request.route_url('item',id=item_one.id)}}" class="text-info good">购买</a>
                                            </p>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    {% endfor %}
                </div>
                <div class="panel-body">
                    <nav>
                        <ul class="pagination">
                            <li {% if page_num==1 %} class="disabled" {% endif %}>
                                <a href="{{request.route_url('category',id=category_id)}}?p={{page_num+1}}" aria-label="Previous">
                                    <span aria-hidden="true">上一页</span>
                                </a>
                            </li>
                            {% for num in range(1,total_page+1) %}
                            <li {% if page_num==num %} class="active" {% endif %}>
                                <a href="#">{{num}} {% if page_num==num %}<span class="sr-only">(current)</span>{% endif %}</a>
                            </li>
                            {% endfor %}
                            <li {% if page_num==total_page %} class="disabled" {% endif %}>
                                <a href="{{request.route_url('category',id=category_id)}}?p={{page_num+1}}" aria-label="Next">
                                    <span aria-hidden="true">下一页</span>
                                </a>
                            </li>
                        </ul>
                    </nav>
                </div>
                {% else %}
                <h1 class="text-danger text-center">暂无相应商品</h1>
                {% endif %}
            </div>
        </div>
        <!--right-->
    </div>
</div>
{% endblock %}